"""计算 1 到 100 的总和"""
n = 100
sum = 0
counter=1
while counter <= n:
    sum = sum +counter
    counter += 1
print("1到%d之和为："%n,sum)

""" while...else在循环条件为false时执行else语句"""
count = 0
while count<5:
    print(count,"小于5")
    count += 1
else:
    print(count,"大于等于5")

""" continue的用法"""
i =1
while i <10:
    i +=1
    if i%2>0:     #非双数时跳过输出
        continue
    print(i)  #输出双数

print('_________________________________')
""" break的用法，满足条件终止循环"""
i =1
while 1:
    print(i)
    i+=1
    if i >10:
        break

